home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
os20
/
wb
/
tm_tools.lha
/
tm_tools
/
GAsk.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-01
|
2KB
|
81 lines
;/* GAsk - compiles with SAS/C 5.10a by executing this file
lc -cfis -v -b0 -iinclude:intui.sym -iinclude:pragmas.sym -O -j73 GAsk
blink GAsk.o to GAsk
quit ;*/
/*
* GAsk
*
* Simple Ask substitute, puts requester up rather than
* a prompt at the Shell. Needs OS2.0+
*
* RC=5 if YES,
* RC=0 if NO.
*
* Martin W. Scott, Sunday 01-Nov-92.
*/
#include <exec/types.h>
#include <dos/dos.h>
#include <dos/rdargs.h>
#include <intuition/intuition.h>
#include <proto/exec.h> /* use PRAGMAS */
#include <proto/dos.h>
#include <proto/intuition.h>
#define PROJECT "GAsk" /* program name */
#define ARGSTR "PROMPT/A/F" /* argument template */
#define NARGS 1 /* number of args in template */
#define PROMPT 0
LONG main(void); /* prototypes */
const char version_str[] = "$VER: GAsk 1.0";
struct DosLibrary *DOSBase;
struct IntuitionBase *IntuitionBase;
BOOL Confirm(char *);
LONG main(void) /* entry: GAsk */
{
struct RDArgs *readargs;
LONG rargs[NARGS];
LONG rc = 20;
if (DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 37L))
{
if (readargs = ReadArgs(ARGSTR, rargs, NULL))
{
if (Confirm((char *)rargs[PROMPT]))
rc = 5;
else
rc = 0;
}
else PrintFault(IoErr(), PROJECT);
CloseLibrary(DOSBase);
}
return rc;
} /* main */
BOOL
Confirm(char *str)
{
struct EasyStruct es;
BOOL success = FALSE;
if (IntuitionBase = (void *)OpenLibrary("intuition.library", 37L))
{
es.es_StructSize = sizeof(struct EasyStruct);
es.es_Flags = 0;
es.es_Title = "Confirm:";
es.es_TextFormat = str;
es.es_GadgetFormat = "Yes|No";
success = EasyRequestArgs(NULL, &es, NULL, NULL);
CloseLibrary(IntuitionBase);
}
return success;
}